﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:SLExtensions.Controls;assembly=SLExtensions.Controls"
                    xmlns:localanim="clr-namespace:SLExtensions.Controls.Animation;assembly=SLExtensions.Controls"
                    xmlns:layers="clr-namespace:SLExtensions.Controls.Layers;assembly=SLExtensions.Controls"
                    xmlns:ve="clr-namespace:SLExtensions.Controls.Layers.VirtualEarth;assembly=SLExtensions.Controls"
                    xmlns:gm="clr-namespace:SLExtensions.Controls.Layers.GoogleMaps;assembly=SLExtensions.Controls"
                    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
                    xmlns:sld="clr-namespace:SLExtensions.Data;assembly=SLExtensions.Data">

    <LinearGradientBrush x:Key="AlphaBackgroundBrush"
                         EndPoint="10,10"
                         StartPoint="0,0"
                         SpreadMethod="Repeat"
                         MappingMode="Absolute">
        <GradientStop Color="Black"
                      Offset="0.5" />
        <GradientStop Offset="1"
                      Color="White" />
        <GradientStop Offset="0"
                      Color="White" />
    </LinearGradientBrush>

    <Style TargetType="layers:LayerHost">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="layers:LayerHost">
                    <Canvas x:Name="RootElement"
                            Background="Transparent">
                        <Canvas x:Name="LayersHost" />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:Slider2D">
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="MaximumX"
                Value="10" />
        <Setter Property="MinimumX"
                Value="0" />
        <Setter Property="MaximumX"
                Value="10" />
        <Setter Property="MinimumX"
                Value="0" />
        <Setter Property="ValueX"
                Value="0" />
        <Setter Property="ValueY"
                Value="0" />
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1"
                                     StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9"
                                  Offset="0" />
                    <GradientStop Color="#FF8399A9"
                                  Offset="0.375" />
                    <GradientStop Color="#FF718597"
                                  Offset="0.375" />
                    <GradientStop Color="#FF617584"
                                  Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="IsTabStop"
                Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Slider2D">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThumbDisabledOverlay"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid x:Name="TemplateRoot"
                              Background="{TemplateBinding Background}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <Thumb Height="11"
                                   x:Name="Thumb"
                                   Width="11"
                                   Grid.Column="1"
                                   Grid.Row="1"
                                   IsTabStop="True" />
                            <Rectangle x:Name="ThumbDisabledOverlay"
                                       RadiusX="2"
                                       RadiusY="2"
                                       Width="11"
                                       Grid.Row="1"
                                       Grid.Column="1"
                                       Fill="White"
                                       Opacity=".55"
                                       Visibility="Collapsed" />

                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ColorPicker">
        <Setter Property="SelectedColor"
                Value="Black" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ColorPicker">
                    <Grid x:Name="RootElement">
                        <Grid.Resources>
                            <ControlTemplate x:Key="SliderThumbControlTemplate"
                                             TargetType="Thumb">
                                <Grid>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver" />
                                            <VisualState x:Name="Pressed" />
                                            <VisualState x:Name="Disabled" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="FocusStates">
                                            <VisualState x:Name="Unfocused" />
                                            <VisualState x:Name="Focused" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Grid Margin="0,-10"
                                          Background="Transparent">
                                        <Path Width="5"
                                              Height="8"
                                              Stretch="Fill"
                                              StrokeLineJoin="Round"
                                              Stroke="White"
                                              Fill="#FF000000"
                                              Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z "
                                              HorizontalAlignment="Left"
                                              VerticalAlignment="Center"
                                              Margin="0,-4"
                                              UseLayoutRounding="False" />
                                        <Path Width="5"
                                              Height="8"
                                              Stretch="Fill"
                                              StrokeLineJoin="Round"
                                              Stroke="White"
                                              Fill="#FF000000"
                                              Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z "
                                              HorizontalAlignment="Right"
                                              RenderTransformOrigin="0.5,0.5"
                                              VerticalAlignment="Center"
                                              Margin="0,-4"
                                              UseLayoutRounding="False">
                                            <Path.RenderTransform>
                                                <RotateTransform Angle="180" />
                                            </Path.RenderTransform>
                                        </Path>
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Name="hueSliderTemplate"
                                             TargetType="Slider">
                                <Grid x:Name="Root">
                                    <Grid.Resources>
                                        <ControlTemplate x:Key="RepeatButtonTemplate">
                                            <Grid x:Name="Root"
                                                  Opacity="0"
                                                  Background="Transparent" />
                                        </ControlTemplate>
                                    </Grid.Resources>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver" />
                                            <VisualState x:Name="Disabled" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Grid x:Name="VerticalTemplate"
                                          Visibility="Collapsed"
                                          Background="{TemplateBinding Background}"
                                          local:Clipper.ClipToBounds="True">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton"
                                                      Width="18"
                                                      IsTabStop="False"
                                                      Template="{StaticResource RepeatButtonTemplate}"
                                                      Grid.Row="2"
                                                      IsHitTestVisible="False" />
                                        <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton"
                                                      Width="18"
                                                      IsTabStop="False"
                                                      Template="{StaticResource RepeatButtonTemplate}"
                                                      Grid.Row="0"
                                                      IsHitTestVisible="False" />
                                        <Thumb x:Name="VerticalThumb"
                                               Height="0"
                                               IsTabStop="True"
                                               Template="{StaticResource SliderThumbControlTemplate}"
                                               Grid.Row="1" />
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="ColorSlider2DTemplate"
                                             TargetType="local:Slider2D">
                                <Grid x:Name="Root">
                                    <Grid.Resources>
                                        <ControlTemplate x:Key="ThumbControlTemplate"
                                                         TargetType="Thumb">
                                            <Grid>
                                                <Grid Background="Transparent"
                                                      Margin="-10">
                                                    <VisualStateManager.VisualStateGroups>
                                                        <VisualStateGroup x:Name="CommonStates">
                                                            <VisualState x:Name="Normal" />
                                                            <VisualState x:Name="MouseOver" />
                                                            <VisualState x:Name="Pressed" />
                                                            <VisualState x:Name="Disabled" />
                                                        </VisualStateGroup>
                                                        <VisualStateGroup x:Name="FocusStates">
                                                            <VisualState x:Name="Unfocused" />
                                                            <VisualState x:Name="Focused" />
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Ellipse StrokeThickness="3"
                                                             Stroke="#FFFFFFFF"
                                                             Width="10"
                                                             Height="10" />
                                                    <Ellipse StrokeThickness="1"
                                                             Stroke="#FF000000"
                                                             Width="10"
                                                             Height="10" />
                                                </Grid>
                                            </Grid>
                                        </ControlTemplate>
                                    </Grid.Resources>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver" />
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="ThumbDisabledOverlay"
                                                                                   Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <Visibility>Visible</Visibility>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Grid x:Name="TemplateRoot"
                                          Background="{TemplateBinding Background}">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Thumb x:Name="Thumb"
                                               Height="0"
                                               Width="0"
                                               IsTabStop="True"
                                               Grid.Column="1"
                                               Grid.Row="1"
                                               Template="{StaticResource ThumbControlTemplate}" />
                                        <Rectangle x:Name="ThumbDisabledOverlay"
                                                   Fill="White"
                                                   RadiusX="2"
                                                   RadiusY="2"
                                                   Width="11"
                                                   Opacity=".55"
                                                   Visibility="Collapsed"
                                                   Grid.Column="1"
                                                   Grid.Row="1" />
                                    </Grid>
                                </Grid>
                            </ControlTemplate>

                            <ControlTemplate x:Key="AlphaSliderTemplate"
                                             TargetType="Slider">
                                <Grid x:Name="Root">
                                    <Grid.Resources>
                                        <ControlTemplate x:Key="RepeatButtonTemplate">
                                            <Grid x:Name="Root"
                                                  Opacity="0"
                                                  Background="Transparent" />
                                        </ControlTemplate>
                                    </Grid.Resources>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver" />
                                            <VisualState x:Name="Disabled" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Grid x:Name="VerticalTemplate"
                                          Visibility="Collapsed"
                                          local:Clipper.ClipToBounds="True">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <RepeatButton IsHitTestVisible="False"
                                                      x:Name="VerticalTrackLargeChangeDecreaseRepeatButton"
                                                      Width="18"
                                                      IsTabStop="False"
                                                      Template="{StaticResource RepeatButtonTemplate}"
                                                      Grid.Row="2" />
                                        <Grid Grid.RowSpan="3"
                                              Background="{StaticResource AlphaBackgroundBrush}" />
                                        <Grid Background="{TemplateBinding Background}"
                                              Grid.RowSpan="3">
                                            <Grid.OpacityMask>
                                                <LinearGradientBrush EndPoint="0,1"
                                                                     StartPoint="0,0">
                                                    <GradientStop Color="Black"
                                                                  Offset="0" />
                                                    <GradientStop Color="Transparent"
                                                                  Offset="1" />
                                                </LinearGradientBrush>
                                            </Grid.OpacityMask>
                                        </Grid>
                                        <Thumb x:Name="VerticalThumb"
                                               Height="0"
                                               IsTabStop="True"
                                               Grid.Row="1"
                                               Template="{StaticResource SliderThumbControlTemplate}" />
                                        <RepeatButton IsHitTestVisible="False"
                                                      x:Name="VerticalTrackLargeChangeIncreaseRepeatButton"
                                                      Width="18"
                                                      IsTabStop="False"
                                                      Template="{StaticResource RepeatButtonTemplate}"
                                                      Grid.Row="0" />
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="20" />
                            <ColumnDefinition Width="20" />
                            <ColumnDefinition />


                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Slider x:Name="HueSelector"
                                Background="{TemplateBinding HueMonitorBrush}"
                                Minimum="0"
                                Maximum="1"
                                SmallChange="0.05"
                                LargeChange="0.1"
                                Value="{Binding HuePosition, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                IsDirectionReversed="True"
                                Orientation="Vertical"
                                Template="{StaticResource hueSliderTemplate}"
                                local:SliderExtensions.SetMouseDownPositionValue="True" />
                        <local:Slider2D x:Name="ColorSelector"
                                        ValueX="{Binding ColorXPosition, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                        ValueY="{Binding ColorYPosition, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                        MinimumX="0"
                                        MaximumX="1"
                                        SmallChangeX="0.05"
                                        MinimumY="0"
                                        MaximumY="1"
                                        SmallChangeY="0.05"
                                        Background="{TemplateBinding SatValBrush}"
                                        SetMouseDownPositionValue="True"
                                        Grid.Column="2"
                                        Template="{StaticResource ColorSlider2DTemplate}" />

                        <Slider x:Name="AlphaSelector"
                                Value="{Binding Alpha, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                Grid.Column="1"
                                Minimum="0"
                                Maximum="1"
                                SmallChange="0.05"
                                Orientation="Vertical"
                                Template="{StaticResource AlphaSliderTemplate}"
                                Background="{TemplateBinding RGBColorBrush}"
                                local:SliderExtensions.SetMouseDownPositionValue="True" />
                        <Rectangle Grid.Row="1"
                                   Fill="{StaticResource AlphaBackgroundBrush}" />
                        <Rectangle Grid.Row="1"
                                   Fill="{TemplateBinding SelectedColorBrush}" />
                        <TextBox x:Name="HexValue"
                                 Text="{Binding SelectedColor, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
                                 Grid.Row="1"
                                 Grid.Column="1"
                                 Grid.ColumnSpan="2" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="ve:HybridView">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ve:HybridView">
                    <Canvas>
                        <ItemsPresenter />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ve:AerialView">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ve:AerialView">
                    <Canvas>
                        <ItemsPresenter />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ve:RoadView">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ve:RoadView">
                    <Canvas>
                        <ItemsPresenter />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="gm:AerialView">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="gm:AerialView">
                    <Canvas>
                        <ItemsPresenter />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="gm:RoadView">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="gm:RoadView">
                    <Canvas>
                        <ItemsPresenter />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="layers:LayerSource">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="layers:LayerSource">
                    <Canvas>
                        <ItemsPresenter />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="layers:LayerItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="layers:LayerItem">
                    <Canvas x:Name="RootElement">
                        <Canvas.Resources>
                            <Storyboard x:Name="Normal State" />
                            <Storyboard x:Name="MouseOver State" />
                            <Storyboard x:Name="Removing State" />
                        </Canvas.Resources>
                        <ContentPresenter Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Margin="{TemplateBinding Padding}" />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="local:TreeView">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TreeView">
                    <Border Name="Border"
                            CornerRadius="1"
                            BorderThickness="1">
                        <!--<ScrollViewer Padding="4" x:Name="ScrollViewer" VerticalScrollBarVisibility="Auto" Background="{TemplateBinding Background}">-->
                        <ItemsPresenter />
                        <!--</ScrollViewer>-->
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:TreeViewItem">
        <Setter Property="Padding"
                Value="1,0,0,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TreeViewItem">
                    <Grid x:Name="LayoutRoot">
                        <Grid.Resources>
                            <Style x:Key="TreeViewItemExpanderButtonStyle"
                                   TargetType="ToggleButton">
                                <Setter Property="IsEnabled"
                                        Value="true" />
                                <Setter Property="IsTabStop"
                                        Value="true" />
                                <Setter Property="Background"
                                        Value="#FF003255" />
                                <Setter Property="Foreground"
                                        Value="#FF313131" />
                                <Setter Property="Margin"
                                        Value="0" />
                                <Setter Property="HorizontalContentAlignment"
                                        Value="Center" />
                                <Setter Property="VerticalContentAlignment"
                                        Value="Center" />
                                <Setter Property="Cursor"
                                        Value="Arrow" />
                                <Setter Property="FontSize"
                                        Value="11" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ToggleButton">
                                            <Grid Background="Transparent">
                                                <Grid.Resources>
                                                    <SolidColorBrush x:Key="GlyphBrush"
                                                                     Color="#444" />
                                                </Grid.Resources>

                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="Auto" />
                                                    <ColumnDefinition Width="Auto" />
                                                </Grid.ColumnDefinitions>

                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualStateGroup.Transitions>
                                                            <vsm:VisualTransition GeneratedDuration="0:0:0.1"
                                                                                  To="MouseOver" />
                                                            <vsm:VisualTransition GeneratedDuration="0:0:0.1"
                                                                                  To="Pressed" />
                                                        </vsm:VisualStateGroup.Transitions>
                                                        <vsm:VisualState x:Name="Normal">
                                                            <Storyboard />
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="MouseOver">
                                                            <Storyboard />
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Pressed">
                                                            <Storyboard />
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled">
                                                            <Storyboard />
                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="CheckStates">
                                                        <vsm:VisualStateGroup.Transitions>
                                                            <vsm:VisualTransition GeneratedDuration="0:0:0.1" />
                                                            <vsm:VisualTransition GeneratedDuration="00:00:00.2000000"
                                                                                  From="Checked"
                                                                                  To="Unchecked" />
                                                            <vsm:VisualTransition GeneratedDuration="00:00:00.2000000"
                                                                                  From="Unchecked"
                                                                                  To="Checked" />
                                                        </vsm:VisualStateGroup.Transitions>
                                                        <vsm:VisualState x:Name="Checked">
                                                            <Storyboard />
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Unchecked">
                                                            <Storyboard>
                                                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                               Duration="00:00:00.0010000"
                                                                                               Storyboard.TargetName="ExpandPath"
                                                                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                                                    <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                                          Value="-90" />
                                                                </DoubleAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Indeterminate">
                                                            <Storyboard />
                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="FocusStates">
                                                        <vsm:VisualState x:Name="Focused">
                                                            <Storyboard />
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Unfocused">
                                                            <Storyboard />
                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>
                                                <Path x:Name="ExpandPath"
                                                      Opacity="0.995"
                                                      HorizontalAlignment="Left"
                                                      VerticalAlignment="Center"
                                                      Margin="1,1,1,1"
                                                      Fill="{StaticResource GlyphBrush}"
                                                      Data="M 0 4 L 8 4 L 4 8 Z"
                                                      RenderTransformOrigin="0.5,0.5">
                                                    <Path.RenderTransform>
                                                        <TransformGroup>
                                                            <ScaleTransform />
                                                            <SkewTransform />
                                                            <RotateTransform />
                                                            <TranslateTransform />
                                                        </TransformGroup>
                                                    </Path.RenderTransform>
                                                </Path>

                                                <ContentPresenter Content="{TemplateBinding Content}"
                                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                  Margin="{TemplateBinding Padding}" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Grid.Resources>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SelectionStates">
                                <vsm:VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="nodeSelection"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="nodeSelection"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                                                  Value="1.0" />
                                        </DoubleAnimationUsingKeyFrames>

                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unselected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="nodeSelection"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.2000000">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="nodeSelection"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>

                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ItemStates">
                                <vsm:VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="ItemsHost"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.2000000">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="ItemsHost"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                                                  Value="0.0" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unfocused" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SourceStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.2000000"
                                                          To="HasItems" />
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.2000000"
                                                          To="NoItems" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="HasItems">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="Expander"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="NoItems">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="Expander"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MinWidth="19"
                                              Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <Rectangle x:Name="nodeSelection"
                                   Grid.RowSpan="1"
                                   Grid.ColumnSpan="2"
                                   Stroke="Black"
                                   Fill="#AAAAAAFF"
                                   StrokeDashArray="2"
                                   Visibility="Collapsed"
                                   Opacity="0" />

                        <ToggleButton x:Name="Expander"
                                      Style="{StaticResource TreeViewItemExpanderButtonStyle}"
                                      IsChecked="{TemplateBinding IsExpanded}"
                                      Opacity="0"
                                      IsThreeState="False"
                                      Width="16"
                                      Height="16" />
                        <Border x:Name="Bd"
                                Grid.Column="1"
                                Padding="{TemplateBinding Padding}"
                                Background="Transparent">
                            <ContentControl x:Name="PART_Header"
                                            Content="{TemplateBinding Header}"
                                            ContentTemplate="{TemplateBinding HeaderTemplate}" />
                        </Border>
                        <ItemsPresenter x:Name="ItemsHost"
                                        Visibility="Collapsed"
                                        Opacity="0"
                                        Grid.Row="1"
                                        Grid.Column="1"
                                        Grid.ColumnSpan="2" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:VirtualizedListBox">
        <Setter Property="Padding"
                Value="1,0,0,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:VirtualizedListBox">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="20" />
                        </Grid.ColumnDefinitions>

                        <local:VirtualizedStackPanel x:Name="virtualizedStackPanel"
                                                     ItemContainerGenerator="{TemplateBinding ItemContainerGenerator}"
                                                     Orientation="Vertical"
                                                     ItemsSource="{TemplateBinding ItemsSource}"
                                                     ItemTemplate="{TemplateBinding ItemTemplate}" />

                        <ScrollBar x:Name="scrollBar"
                                   Orientation="Vertical"
                                   Grid.Column="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:VirtualizedListBoxItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:VirtualizedListBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.2000000" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HoverOverlay"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To=".75"
                                                         Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="fillStop0Hover"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#FFF9FAFA"
                                                        Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="fillStop1Hover"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#FFD6DFE7"
                                                        Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="fillStop2Hover"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#FFD3E4F5"
                                                        Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="strokeStop0Hover"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#00000000"
                                                        Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="strokeStop1Hover"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#00000000"
                                                        Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SelectionStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.2000000" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Unselected" />
                                <vsm:VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="fillStop0"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#FFD9EFFF"
                                                        Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="fillStop1"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#FFBDD2E6"
                                                        Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="fillStop2"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#FFA1B6CD"
                                                        Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="strokeStop0"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#FF77B9EB"
                                                        Duration="0" />
                                        <ColorAnimation Storyboard.TargetName="strokeStop1"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#FF4887CD"
                                                        Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>


                        <Rectangle IsHitTestVisible="False">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0.316111,0.0165521"
                                                     EndPoint="0.316111,0.724833">
                                    <GradientStop x:Name="fillStop0"
                                                  Color="#00000000"
                                                  Offset="0" />
                                    <GradientStop x:Name="fillStop1"
                                                  Color="#00000000"
                                                  Offset="0.682203" />
                                    <GradientStop x:Name="fillStop2"
                                                  Color="#00000000"
                                                  Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                            <Rectangle.Stroke>
                                <LinearGradientBrush StartPoint="0.318122,0.0360108"
                                                     EndPoint="0.318122,0.715784">
                                    <GradientStop x:Name="strokeStop0"
                                                  Color="#00000000"
                                                  Offset="0" />
                                    <GradientStop x:Name="strokeStop1"
                                                  Color="#00000000"
                                                  Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                        </Rectangle>
                        <Rectangle x:Name="HoverOverlay"
                                   IsHitTestVisible="False"
                                   Opacity="0">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0.316111,0.0165521"
                                                     EndPoint="0.316111,0.724833">
                                    <GradientStop x:Name="fillStop0Hover"
                                                  Color="#00000000"
                                                  Offset="0" />
                                    <GradientStop x:Name="fillStop1Hover"
                                                  Color="#00000000"
                                                  Offset="0.682203" />
                                    <GradientStop x:Name="fillStop2Hover"
                                                  Color="#00000000"
                                                  Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                            <Rectangle.Stroke>
                                <LinearGradientBrush StartPoint="0.318122,0.0360108"
                                                     EndPoint="0.318122,0.715784">
                                    <GradientStop x:Name="strokeStop0Hover"
                                                  Color="#00000000"
                                                  Offset="0" />
                                    <GradientStop x:Name="strokeStop1Hover"
                                                  Color="#00000000"
                                                  Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                        </Rectangle>

                        <Rectangle x:Name="FocusVisual"
                                   Stroke="Black"
                                   StrokeDashArray="1,2"
                                   Visibility="Collapsed"
                                   IsHitTestVisible="False" />
                        <ContentControl Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:SwappableContentControl">
        <Setter Property="Padding"
                Value="1,0,0,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:SwappableContentControl">
                    <Grid x:Name="LayoutRoot">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="ShowPresenter1">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="wrapperElement2"
                                                                       Storyboard.TargetProperty="MarginHorizontalPercentShift">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                                                  Value="2" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="presenter2"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.2000000">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="wrapperElement1"
                                                                       Storyboard.TargetProperty="MarginHorizontalPercentShift">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.0000000"
                                                                  Value="2" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                                                  Value="2" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.4000000"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="presenter1"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.2000000">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="ShowPresenter2">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="wrapperElement1"
                                                                       Storyboard.TargetProperty="MarginHorizontalPercentShift">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                                                  Value="2" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="presenter1"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.2000000">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="wrapperElement2"
                                                                       Storyboard.TargetProperty="MarginHorizontalPercentShift">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.0000000"
                                                                  Value="2" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                                                  Value="2" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.4000000"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="presenter2"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.2000000">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <ContentPresenter x:Name="presenter1"
                                          Content="{TemplateBinding Presenter1Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Visibility="Collapsed"
                                          VerticalAlignment="Stretch"
                                          HorizontalAlignment="Stretch" />
                        <ContentPresenter x:Name="presenter2"
                                          Content="{TemplateBinding Presenter2Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Visibility="Collapsed"
                                          VerticalAlignment="Stretch"
                                          HorizontalAlignment="Stretch" />

                        <!--<localanim:MarginWrapper x:Name="wrapperElement1"
                                                 ElementName="presenter1"
                                                 MarginHorizontalPercentShift="2" />
                        <localanim:MarginWrapper x:Name="wrapperElement2"
                                                 ElementName="presenter2"
                                                 MarginHorizontalPercentShift="2" />-->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="local:ToolTip">
        <Setter Property="Foreground"
                Value="#FF313131" />
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush x:Name="ToolTipBackground"
                                     StartPoint="0,0"
                                     EndPoint="0,1">
                    <LinearGradientBrush.GradientStops>
                        <GradientStop Color="#FFF9FAFA"
                                      Offset="0" />
                        <GradientStop Color="#FFEDF1F4"
                                      Offset="0.37259" />
                        <GradientStop Color="#FFE2E8EF"
                                      Offset="0.372881" />
                        <GradientStop Color="#FFC3C9CD"
                                      Offset="1" />
                    </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ToolTip">
                    <Border Background="#06000000"
                            Padding="1.5"
                            CornerRadius="2">
                        <Border Background="#06000000"
                                Padding="1.5"
                                CornerRadius="1.5">
                            <Border Background="#FFFFFFFF"
                                    BorderThickness=".5"
                                    BorderBrush="#FF000000"
                                    CornerRadius="1.5"
                                    Padding="1">
                                <Border Name="RootElement"
                                        Background="{TemplateBinding Background}"
                                        BorderThickness="1"
                                        BorderBrush="#FFFFFFFF"
                                        CornerRadius="1.25"
                                        Padding="4,4,4,3">
                                    <Border.Resources>
                                        <Storyboard x:Key="Visible State" />
                                        <Storyboard x:Key="Normal State" />
                                    </Border.Resources>
                                    <ContentPresenter Content="{TemplateBinding Content}"
                                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                                      Margin="{TemplateBinding Padding}" />
                                </Border>
                            </Border>
                        </Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:Viewbox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Viewbox">
                    <Canvas x:Name="LayoutRoot"
                            Width="{TemplateBinding Width}"
                            Height="{TemplateBinding Height}">

                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ChangeTracker">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ChangeTracker">
                    <StackPanel x:Name="RootElement"
                                Orientation="Horizontal"
                                Visibility="Collapsed">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="ModificationStates">
                                <vsm:VisualState x:Name="Unchanged">
                                    <Storyboard />
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Modified">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootElement"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Button x:Name="CommitButton"
                                Content="Save" />
                        <Button x:Name="RevertButton"
                                Margin="10, 0,0,0"
                                Content="Cancel" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="local:ReCaptcha">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ReCaptcha">
                    <Grid x:Name="RootElement">
                        <Grid.Resources>
                            <Style x:Key="reloadStyle"
                                   TargetType="Button">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Button">
                                            <Grid x:Name="LayoutRoot"
                                                  Background="Transparent">
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="FocusStates">
                                                        <vsm:VisualState x:Name="Focused" />
                                                        <vsm:VisualState x:Name="Unfocused" />
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualStateGroup.Transitions>
                                                            <vsm:VisualTransition GeneratedDuration="00:00:00.2000000" />
                                                        </vsm:VisualStateGroup.Transitions>
                                                        <vsm:VisualState x:Name="Normal" />
                                                        <vsm:VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FFFFFFFF" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Pressed">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FF707070" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled" />
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>
                                                <Path x:Name="path"
                                                      Width="20"
                                                      Height="20"
                                                      Stretch="Fill"
                                                      Fill="#FFC8D2D7"
                                                      Margin="2"
                                                      Data="M 125.383,67.5065L 114.107,63.7952L 117.031,61.8825C 115.134,59.798 112.399,58.4895 109.359,58.4895C 103.632,58.4895 98.9892,63.1322 98.9892,68.8593C 98.9892,74.5862 103.632,79.2289 109.359,79.2289C 113.645,79.2289 117.324,76.6285 118.904,72.9191L 125.935,75.5183C 123.295,82.0834 116.868,86.7182 109.359,86.7182C 99.4957,86.7182 91.4999,78.7225 91.4999,68.8592C 91.4999,58.996 99.4957,51.0002 109.359,51.0002C 115.024,51.0002 120.073,53.6379 123.345,57.7521L 126.5,55.6879L 125.383,67.5065 Z " />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                            <Style x:Key="imageStyle"
                                   TargetType="Button">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Button">
                                            <Grid x:Name="LayoutRoot"
                                                  Background="Transparent">
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="FocusStates">
                                                        <vsm:VisualState x:Name="Focused" />
                                                        <vsm:VisualState x:Name="Unfocused" />
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualStateGroup.Transitions>
                                                            <vsm:VisualTransition GeneratedDuration="00:00:00.2000000" />
                                                        </vsm:VisualStateGroup.Transitions>
                                                        <vsm:VisualState x:Name="Normal" />
                                                        <vsm:VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FFFFFFFF" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Pressed">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FF707070" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled" />
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>
                                                <Path x:Name="path"
                                                      Width="16.88"
                                                      Height="18"
                                                      Margin="2"
                                                      Stretch="Fill"
                                                      Fill="#FFC8D2D7"
                                                      Data="F1 M 288.34,235.84L 288.82,242.74L 287.928,242.74C 287.747,241.43 287.505,240.493 287.2,239.927C 286.7,239.022 286.035,238.355 285.205,237.925C 284.375,237.495 283.283,237.28 281.928,237.28L 277.3,237.28L 277.3,257.24C 277.3,259.26 277.502,260.52 277.907,261.02C 278.482,261.7 279.365,262.04 280.555,262.04L 281.62,262.04L 281.62,263L 268.66,263L 268.66,262.04L 269.74,262.04C 271.03,262.04 271.945,261.62 272.485,260.78C 272.815,260.26 272.98,259.08 272.98,257.24L 272.98,237.28L 269.14,237.28C 267.65,237.28 266.592,237.39 265.967,237.61C 265.147,237.905 264.448,238.475 263.868,239.32C 263.288,240.165 262.943,241.305 262.832,242.74L 261.94,242.74L 262.42,235.84L 288.34,235.84 Z " />


                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                            <Style x:Key="audioStyle"
                                   TargetType="Button">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Button">
                                            <Grid x:Name="LayoutRoot"
                                                  Background="Transparent">
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="FocusStates">
                                                        <vsm:VisualState x:Name="Focused" />
                                                        <vsm:VisualState x:Name="Unfocused" />
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualStateGroup.Transitions>
                                                            <vsm:VisualTransition GeneratedDuration="00:00:00.2000000" />
                                                        </vsm:VisualStateGroup.Transitions>
                                                        <vsm:VisualState x:Name="Normal" />
                                                        <vsm:VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FFFFFFFF" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Pressed">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FF707070" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled" />
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>
                                                <Path x:Name="path"
                                                      Width="16"
                                                      Height="20"
                                                      Stretch="Fill"
                                                      Fill="#FFC8D2D7"
                                                      Margin="2"
                                                      Data="M 195.6,166L 205.4,166L 205.4,180L 195.6,180L 195.6,166 Z M 223.527,147.751L 223.527,198.249L 209.722,183.467L 209.722,162.534L 223.527,147.751 Z " />

                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                            <Style x:Key="playStyle"
                                   TargetType="Button">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Button">
                                            <Grid x:Name="LayoutRoot"
                                                  Background="Transparent">
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="FocusStates">
                                                        <vsm:VisualState x:Name="Focused" />
                                                        <vsm:VisualState x:Name="Unfocused" />
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualStateGroup.Transitions>
                                                            <vsm:VisualTransition GeneratedDuration="00:00:00.2000000" />
                                                        </vsm:VisualStateGroup.Transitions>
                                                        <vsm:VisualState x:Name="Normal" />
                                                        <vsm:VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FFFFFFFF" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Pressed">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FF707070" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled" />
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>
                                                <Path x:Name="path"
                                                      Width="19.2354"
                                                      Height="22.2111"
                                                      Margin="2"
                                                      Stretch="Fill"
                                                      Fill="#FFC8D2D7"
                                                      Data="F1 M 305.907,123.667L 286.672,112.561L 286.672,134.772L 305.907,123.667 Z " />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                            <Style x:Key="stopStyle"
                                   TargetType="Button">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Button">
                                            <Grid x:Name="LayoutRoot"
                                                  Background="Transparent">
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="FocusStates">
                                                        <vsm:VisualState x:Name="Focused" />
                                                        <vsm:VisualState x:Name="Unfocused" />
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualStateGroup.Transitions>
                                                            <vsm:VisualTransition GeneratedDuration="00:00:00.2000000" />
                                                        </vsm:VisualStateGroup.Transitions>
                                                        <vsm:VisualState x:Name="Normal" />
                                                        <vsm:VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FFFFFFFF" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Pressed">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                              Duration="00:00:00.0010000"
                                                                                              Storyboard.TargetName="path"
                                                                                              Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <SplineColorKeyFrame KeyTime="00:00:00"
                                                                                         Value="#FF707070" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled" />
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>
                                                <Rectangle x:Name="path"
                                                           Width="18"
                                                           Height="18"
                                                           Margin="2"
                                                           Stretch="Fill"
                                                           Fill="#FFC8D2D7" />


                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="44" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CaptchaStates">
                                <vsm:VisualState x:Name="Audio">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="audioButtons"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="mediaElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="image"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="showAudioElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="showImageElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Image">
                                    <Storyboard />
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Rectangle RadiusX="3"
                                   RadiusY="3"
                                   VerticalAlignment="Stretch"
                                   Grid.RowSpan="2"
                                   Grid.ColumnSpan="2">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1"
                                                     StartPoint="0.5,0">
                                    <GradientStop Color="#FF790000"
                                                  Offset="1" />
                                    <GradientStop Color="#FFB72C19"
                                                  Offset="0" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Image Source="{TemplateBinding ImageSource}"
                               Stretch="None"
                               Visibility="Visible"
                               HorizontalAlignment="Stretch"
                               Margin="5,5,5,5"
                               x:Name="image"
                               Width="300"
                               Height="57">
                            <Image.Clip>
                                <RectangleGeometry Rect="0,0,300,57"
                                                   RadiusX="3"
                                                   RadiusY="3" />
                            </Image.Clip>
                        </Image>
                        <MediaElement AutoPlay="True"
                                      Source="{TemplateBinding WaveUri}"
                                      Visibility="Collapsed"
                                      Height="57"
                                      Margin="5,5,5,5"
                                      VerticalAlignment="Bottom"
                                      Grid.ColumnSpan="1"
                                      x:Name="mediaElement"
                                      Width="300" />
                        <StackPanel x:Name="audioButtons"
                                    Orientation="Horizontal"
                                    Visibility="Collapsed">
                            <Button x:Name="playElement"
                                    Content="Play"
                                    Style="{StaticResource playStyle}" />
                            <Button x:Name="stopElement"
                                    Content="Stop"
                                    Style="{StaticResource stopStyle}" />
                        </StackPanel>
                        <TextBox HorizontalAlignment="Stretch"
                                 VerticalAlignment="Top"
                                 TextWrapping="Wrap"
                                 Grid.Row="1"
                                 x:Name="inputElement" />
                        <StackPanel Grid.Column="1">
                            <Button x:Name="showAudioElement"
                                    Content="Audio"
                                    Height="24"
                                    Style="{StaticResource audioStyle}" />
                            <Button x:Name="showImageElement"
                                    Content="Image"
                                    Height="24"
                                    Style="{StaticResource imageStyle}"
                                    Visibility="Collapsed" />
                            <Button x:Name="reloadElement"
                                    Content="Reload"
                                    Style="{StaticResource reloadStyle}" />
                            <HyperlinkButton Content="?"
                                             Grid.Column="1"
                                             Grid.Row="1"
                                             NavigateUri="http://recaptcha.net/popuphelp/"
                                             TargetName="_blank"
                                             Foreground="White"
                                             x:Name="hyperlinkButton"
                                             VerticalContentAlignment="Stretch"
                                             HorizontalContentAlignment="Stretch">
                            </HyperlinkButton>
                        </StackPanel>

                        <Button Grid.Column="1"
                                Grid.Row="1"
                                Content="Verify"
                                x:Name="verifyElement">
                        </Button>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--HtmlEditor-->
    <Style TargetType="local:HtmlEditor">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:HtmlEditor">
                    <Grid x:Name="RootElement"
                          Background="{TemplateBinding Background}">

                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="Disabled" />
                            </vsm:VisualStateGroup>

                            <vsm:VisualStateGroup x:Name="MenuStates">
                                <vsm:VisualState x:Name="Collapsed" />
                                <vsm:VisualState x:Name="ForeColor Expanded">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.1"
                                                         Storyboard.TargetName="ForeColorPalette"
                                                         Storyboard.TargetProperty="Height"
                                                         From="0"
                                                         To="48" />
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="BackgroundColor Expanded">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.1"
                                                         Storyboard.TargetName="BackgroundColorPalette"
                                                         Storyboard.TargetProperty="Height"
                                                         From="0"
                                                         To="48" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Grid.Resources>
                            <localanim:HtmlAnimation x:Name="HtmlAnimationIframePlace">
                            </localanim:HtmlAnimation>
                            <Style x:Key="MenuColorButtonStyle"
                                   TargetType="Button">
                                <Setter Property="Width"
                                        Value="24" />
                                <Setter Property="Height"
                                        Value="24" />
                            </Style>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <local:DockPanel LastChildFill="True">
                            <StackPanel x:Name="PanelCommandContainer"
                                        local:DockPanel.Dock="Top"
                                        Orientation="Vertical"
                                        VerticalAlignment="Stretch"
                                        HorizontalAlignment="Stretch"
                                        Grid.Row="0"
                                        Grid.Column="0">
                                <StackPanel Orientation="Horizontal"
                                            VerticalAlignment="Top"
                                            HorizontalAlignment="Center"
                                            Height="48">
                                    <Button x:Name="ButtonBoldElement"
                                            Content="Bold" />
                                    <Button x:Name="ButtonItalicElement"
                                            Content="Italic" />
                                    <Button x:Name="ButtonUnderlineElement"
                                            Content="Underline" />
                                    <Button x:Name="ButtonIndentElement"
                                            Content="In" />
                                    <Button x:Name="ButtonOutdentElement"
                                            Content="Out" />
                                    <Button x:Name="ButtonAlignLeftElement"
                                            Content="Left" />
                                    <Button x:Name="ButtonAlignCenterElement"
                                            Content="Center" />
                                    <Button x:Name="ButtonAlignRightElement"
                                            Content="Right" />
                                    <Button x:Name="ButtonAlignJustifyElement"
                                            Content="Justifiy" />
                                    <Button x:Name="ButtonOrderedListElement"
                                            Content="OL" />
                                    <Button x:Name="ButtonBulletedListElement"
                                            Content="BL" />
                                    <Button x:Name="ButtonHorizontalRuleElement"
                                            Content="HR" />
                                    <Button x:Name="ButtonSubscriptElement"
                                            Content="SbS" />
                                    <Button x:Name="ButtonSuperscriptElement"
                                            Content="SsS" />
                                    <ToggleButton x:Name="ButtonForeColorElement"
                                                  Content="ForeColor" />
                                    <ToggleButton x:Name="ButtonBackgroundColorElement"
                                                  Content="BackgroundColor" />
                                </StackPanel>
                                <StackPanel x:Name="ForeColorPalette"
                                            Orientation="Horizontal"
                                            VerticalAlignment="Top"
                                            HorizontalAlignment="Left"
                                            Height="0">
                                    <Button Content=""
                                            Tag="#FF0000"
                                            Background="#FFFF0000"
                                            Style="{StaticResource MenuColorButtonStyle}" />
                                    <Button Content=""
                                            Tag="#FF9900"
                                            Background="#FFFF9900"
                                            Style="{StaticResource MenuColorButtonStyle}" />
                                    <Button Content=""
                                            Tag="#00FF00"
                                            Background="#FF00FF00"
                                            Style="{StaticResource MenuColorButtonStyle}" />
                                </StackPanel>
                                <StackPanel x:Name="BackgroundColorPalette"
                                            Orientation="Horizontal"
                                            VerticalAlignment="Top"
                                            HorizontalAlignment="Right"
                                            Height="0">
                                    <Button Content=""
                                            Tag="#FF0000"
                                            Background="#FFFF0000"
                                            Style="{StaticResource MenuColorButtonStyle}" />
                                    <Button Content=""
                                            Tag="#FF9900"
                                            Background="#FFFF9900"
                                            Style="{StaticResource MenuColorButtonStyle}" />
                                    <Button Content=""
                                            Tag="#00FF00"
                                            Background="#FF00FF00"
                                            Style="{StaticResource MenuColorButtonStyle}" />
                                </StackPanel>
                            </StackPanel>
                            <Canvas x:Name="IframePlaceElement"
                                    Background="Transparent"
                                    Margin="4, 4, 4, 4"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch" />
                        </local:DockPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DoubleSlider">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DoubleSlider">

                    <Grid x:Name="LayoutRoot">
                        <Grid.Resources>
                            <Style x:Key="SliderMinStyle"
                                   TargetType="Slider">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Slider">
                                            <Grid Height="3"
                                                  x:Name="Root"
                                                  Width="Auto">
                                                <Grid.Resources>
                                                    <ControlTemplate x:Key="RepeatButtonTemplate">
                                                        <Grid x:Name="Root"
                                                              Opacity="0"
                                                              Background="Transparent" />
                                                    </ControlTemplate>
                                                </Grid.Resources>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="0.028*" />
                                                    <ColumnDefinition Width="0.972*" />
                                                </Grid.ColumnDefinitions>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="0.45*" />
                                                    <RowDefinition Height="0.55*" />
                                                </Grid.RowDefinitions>
                                                <Grid Height="Auto"
                                                      Width="Auto"
                                                      x:Name="HorizontalTemplate"
                                                      Grid.RowSpan="2"
                                                      Grid.ColumnSpan="2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Rectangle Height="3"
                                                               Margin="5,0,5,0"
                                                               Grid.Column="0"
                                                               Grid.ColumnSpan="3"
                                                               Fill="#FFE6EFF7"
                                                               Stroke="Black"
                                                               StrokeThickness="0.5"
                                                               VerticalAlignment="Center" />
                                                    <RepeatButton IsTabStop="False"
                                                                  Template="{StaticResource RepeatButtonTemplate}"
                                                                  x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton"
                                                                  Grid.Column="0" />
                                                    <RepeatButton IsTabStop="False"
                                                                  Template="{StaticResource RepeatButtonTemplate}"
                                                                  x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton"
                                                                  Grid.Column="2" />
                                                    <Thumb Height="11"
                                                           Margin="0,-11,0,0"
                                                           x:Name="HorizontalThumb"
                                                           VerticalAlignment="Top"
                                                           Width="11"
                                                           Grid.Column="1" />
                                                </Grid>
                                                <Grid  Height="Auto"
                                                       Width="Auto"
                                                       x:Name="VerticalTemplate"
                                                       Grid.RowSpan="2"
                                                       Grid.ColumnSpan="2">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="*" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <Rectangle Margin="0,5,0,5"
                                                               Width="3"
                                                               Grid.Row="0"
                                                               Grid.RowSpan="3"
                                                               Fill="#FFE6EFF7"
                                                               Stroke="Black"
                                                               StrokeThickness="0.5" />
                                                    <RepeatButton IsTabStop="False"
                                                                  Template="{StaticResource RepeatButtonTemplate}"
                                                                  x:Name="VerticalTrackLargeChangeDecreaseRepeatButton"
                                                                  Grid.Row="2" />
                                                    <Thumb Height="11"
                                                           x:Name="VerticalThumb"
                                                           Width="11"
                                                           Grid.Row="1"
                                                           Margin="-14,0,0,0" />
                                                    <RepeatButton IsTabStop="False"
                                                                  Template="{StaticResource RepeatButtonTemplate}"
                                                                  x:Name="VerticalTrackLargeChangeIncreaseRepeatButton"
                                                                  Grid.Row="0" />
                                                </Grid>
                                                <Rectangle x:Name="FocusVisual"
                                                           IsHitTestVisible="false"
                                                           Opacity="0"
                                                           Stroke="#666666"
                                                           StrokeDashArray=".2 5"
                                                           StrokeDashCap="Round"
                                                           Grid.RowSpan="1"
                                                           Grid.ColumnSpan="2"
                                                           Margin="0,0,0,0" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                            <Style x:Key="SliderMaxStyle"
                                   TargetType="Slider">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Slider">
                                            <Grid Height="3"
                                                  x:Name="Root"
                                                  Width="Auto">
                                                <Grid.Resources>
                                                    <ControlTemplate x:Key="RepeatButtonTemplate">
                                                        <Grid x:Name="Root"
                                                              Opacity="0"
                                                              Background="Transparent" />
                                                    </ControlTemplate>
                                                </Grid.Resources>
                                                <Grid Height="Auto"
                                                      x:Name="HorizontalTemplate"
                                                      Width="Auto">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Rectangle Height="3"
                                                               Margin="5,0,5,0"
                                                               Grid.Column="0"
                                                               Grid.ColumnSpan="3"
                                                               Fill="#FFE6EFF7"
                                                               Stroke="Black"
                                                               StrokeThickness="0.5"
                                                               VerticalAlignment="Center" />
                                                    <RepeatButton IsTabStop="False"
                                                                  Template="{StaticResource RepeatButtonTemplate}"
                                                                  x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton"
                                                                  Grid.Column="0" />
                                                    <Thumb Height="11"
                                                           Margin="0,0,0,-11"
                                                           x:Name="HorizontalThumb"
                                                           VerticalAlignment="Bottom"
                                                           Width="11"
                                                           Grid.Column="1" />
                                                    <RepeatButton IsTabStop="False"
                                                                  Template="{StaticResource RepeatButtonTemplate}"
                                                                  x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton"
                                                                  Grid.Column="2" />
                                                </Grid>
                                                <Grid Height="Auto"
                                                      Width="Auto"
                                                      x:Name="VerticalTemplate">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="*" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <Rectangle Margin="0,5,0,5"
                                                               Width="3"
                                                               Grid.Row="0"
                                                               Grid.RowSpan="3"
                                                               Fill="#FFE6EFF7"
                                                               Stroke="Black"
                                                               StrokeThickness="0.5" />
                                                    <RepeatButton IsTabStop="False"
                                                                  DataContext="this"
                                                                  Template="{StaticResource RepeatButtonTemplate}"
                                                                  x:Name="VerticalTrackLargeChangeDecreaseRepeatButton"
                                                                  Grid.Row="2" />
                                                    <Thumb Height="11"
                                                           x:Name="VerticalThumb"
                                                           Width="11"
                                                           Grid.Row="1"
                                                           Margin="0,0,12,0"
                                                           HorizontalAlignment="Right" />
                                                    <RepeatButton IsTabStop="False"
                                                                  Template="{StaticResource RepeatButtonTemplate}"
                                                                  x:Name="VerticalTrackLargeChangeIncreaseRepeatButton"
                                                                  Grid.Row="0" />
                                                </Grid>
                                                <Rectangle x:Name="FocusVisual"
                                                           IsHitTestVisible="false"
                                                           Opacity="0"
                                                           Stroke="#666666"
                                                           StrokeDashArray=".2 5"
                                                           StrokeDashCap="Round" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>


                        </Grid.Resources>


                        <Slider x:Name="Slider1"
                                SmallChange="{TemplateBinding SmallChange}"
                                LargeChange="{TemplateBinding LargeChange}"
                                Minimum="{TemplateBinding Minimum}"
                                Maximum="{TemplateBinding Maximum}"
                                Orientation="{TemplateBinding Orientation}"
                                Margin="8,0,0,0"
                                VerticalAlignment="Center"
                                Cursor="{TemplateBinding Cursor}"
                                Style="{StaticResource SliderMinStyle}" />
                        <Slider x:Name="Slider2"
                                SmallChange="{TemplateBinding SmallChange}"
                                LargeChange="{TemplateBinding LargeChange}"
                                Minimum="{TemplateBinding Minimum}"
                                Maximum="{TemplateBinding Maximum}"
                                Orientation="{TemplateBinding Orientation}"
                                Margin="8,0,0,0"
                                VerticalAlignment="Center"
                                Cursor="{TemplateBinding Cursor}"
                                Style="{StaticResource SliderMaxStyle}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="local:Separator">

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Separator">
                    <StackPanel Orientation="{TemplateBinding Orientation}">
                        <Rectangle Fill="#FF8CACD5"
                                   MinWidth="1"
                                   MinHeight="1"
                                   StrokeThickness="0" />
                        <Rectangle Fill="#FFE8F1FC"
                                   MinWidth="1"
                                   MinHeight="1"
                                   StrokeThickness="0" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="local:Decorator">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Decorator">
                    <Border x:Name="outer"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Border x:Name="inner"
                                BorderBrush="{TemplateBinding InnerBorderBrush}"
                                BorderThickness="{TemplateBinding InnerBorderThickness}"
                                Background="{TemplateBinding Background}">
                            <ContentPresenter Content="{TemplateBinding Content}"
                                              ContentTemplate="{TemplateBinding ContentTemplate}" />
                        </Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness"
                Value="0,1,1,0" />
        <Setter Property="InnerBorderThickness"
                Value="0,1,1,0" />
        <Setter Property="BorderBrush"
                Value="#FF567DB0" />
        <Setter Property="InnerBorderBrush"
                Value="#FFFFFFFF" />
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,0"
                                     StartPoint="0.5,1">
                    <GradientStop Color="#FFB0CBEF" />
                    <GradientStop Color="#FFD7E6F9"
                                  Offset="1" />
                    <GradientStop Color="#FFD7E5F7"
                                  Offset="0.019" />
                    <GradientStop Color="#FFB3D0F5"
                                  Offset="0.64" />
                    <GradientStop Color="#FFC7DCF8"
                                  Offset="0.65" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:Timeline">
        <Setter Property="Background"
                Value="#80FFFFFF" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Timeline">
                    <Grid x:Name="LayoutRoot"
                          Background="Transparent">
                        <Grid.Resources>
                            <sld:InvertConverter x:Key="invConverter" />
                            <LinearGradientBrush x:Key="OrangeBrush"
                                                 StartPoint="0.954379,1.01791"
                                                 EndPoint="0.954379,-0.0463469">
                                <GradientStop Color="#FFD4622A"
                                              Offset="0.419492" />
                                <GradientStop Color="#FFE27A47"
                                              Offset="0.699923" />
                                <GradientStop Color="#FFF78B55"
                                              Offset="0.860169" />
                                <GradientStop Color="#FFD4622A"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </Grid.Resources>
                        <Grid.OpacityMask>
                            <LinearGradientBrush EndPoint="1,0"
                                                 StartPoint="0,0">
                                <GradientStop Color="#00000000"
                                              Offset="0" />
                                <GradientStop Color="#00000000"
                                              Offset="1" />
                                <GradientStop Color="#FF000000"
                                              Offset="0.05" />
                                <GradientStop Color="#FF000000"
                                              Offset="0.95" />
                            </LinearGradientBrush>
                        </Grid.OpacityMask>

                        <Rectangle Fill="{TemplateBinding Background}"
                                   Height="6"
                                   VerticalAlignment="Center" />
                        <Canvas x:Name="Marker"
                                HorizontalAlignment="Center"
                                Height="6"
                                VerticalAlignment="Center">

                            <Rectangle DataContext="{TemplateBinding EllapsedTime}"
                                       Width="{TemplateBinding Duration}"
                                       Fill="{StaticResource OrangeBrush}"
                                       Canvas.Left="{Binding Converter={StaticResource invConverter}}"
                                       Height="6" />
                            <Border Width="3"
                                    Height="12"
                                    IsHitTestVisible="False"
                                    Canvas.Top="-3">
                                <Grid>
                                    <Rectangle x:Name="l"
                                               Width="3"
                                               Margin="-3,0,0,0"
                                               HorizontalAlignment="Left"
                                               Stretch="Fill">
                                        <Rectangle.Fill>
                                            <RadialGradientBrush RadiusX="0.501004"
                                                                 RadiusY="0.990059"
                                                                 Center="0.98387,0.499997"
                                                                 GradientOrigin="0.98387,0.499997">
                                                <RadialGradientBrush.RelativeTransform>
                                                    <TransformGroup>
                                                        <RotateTransform CenterX="0.98387"
                                                                         CenterY="0.499997"
                                                                         Angle="90" />
                                                    </TransformGroup>
                                                </RadialGradientBrush.RelativeTransform>
                                                <GradientStop Color="#80000000"
                                                              Offset="0" />
                                                <GradientStop Color="#41000000"
                                                              Offset="0.535575" />
                                                <GradientStop Color="#00000000"
                                                              Offset="0.983871" />
                                            </RadialGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <Rectangle x:Name="r"
                                               Width="3"
                                               Margin="0,0,-3,0"
                                               HorizontalAlignment="Right">
                                        <Rectangle.Fill>
                                            <RadialGradientBrush RadiusX="0.501004"
                                                                 RadiusY="0.990059"
                                                                 Center="0.0161297,0.5"
                                                                 GradientOrigin="0.0161297,0.5">
                                                <RadialGradientBrush.RelativeTransform>
                                                    <TransformGroup>
                                                        <RotateTransform CenterX="0.0161297"
                                                                         CenterY="0.5"
                                                                         Angle="-90" />
                                                    </TransformGroup>
                                                </RadialGradientBrush.RelativeTransform>
                                                <GradientStop Color="#80000000"
                                                              Offset="0" />
                                                <GradientStop Color="#41000000"
                                                              Offset="0.535575" />
                                                <GradientStop Color="#00000000"
                                                              Offset="0.983871" />
                                            </RadialGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <Rectangle x:Name="c">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush StartPoint="1.04908,-0.0509299"
                                                                 EndPoint="1.04908,0.996687">
                                                <GradientStop Color="#00FFFFFF"
                                                              Offset="0" />
                                                <GradientStop Color="#FFFFFFFF"
                                                              Offset="0.368627" />
                                                <GradientStop Color="#FFFFFFFF"
                                                              Offset="0.678431" />
                                                <GradientStop Color="#80FFFFFF"
                                                              Offset="0.883066" />
                                                <GradientStop Color="#00FFFFFF"
                                                              Offset="1" />
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                </Grid>
                            </Border>
                        </Canvas>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:SliderGauge">
        <Setter Property="Height"
                Value="20" />
        <Setter Property="Width"
                Value="200" />
        <Setter Property="FontSize"
                Value="15" />
        <Setter Property="Orientation"
                Value="Horizontal" />
        <Setter Property="FontColor"
                Value="White" />
        <Setter Property="Foreground">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0"
                                     EndPoint="0,1">
                    <GradientStop Offset="0"
                                  Color="#FFB9FF87" />
                    <GradientStop Offset="1"
                                  Color="#FF3BA521" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0"
                                     EndPoint="0,1">
                    <GradientStop Offset="0"
                                  Color="#FFC0C0C0" />
                    <GradientStop Offset="1"
                                  Color="#FF303030" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:SliderGauge">
                    <Grid x:Name="RootElement">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0:0:0.3" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseDown">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PercentageTextBlock"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Rectangle x:Name="ShadowElement"
                                   RadiusX="3"
                                   RadiusY="3"
                                   Fill="{TemplateBinding Background}"
                                   Stretch="Fill" />

                        <Rectangle x:Name="HighlightElement"
                                   RadiusX="3"
                                   RadiusY="3"
                                   Fill="{TemplateBinding Foreground}"
                                   Stretch="Fill" />

                        <TextBlock x:Name="PercentageTextBlock"
                                   Foreground="{TemplateBinding FontColor}"
                                   Opacity="0"
                                   Visibility="Collapsed"
                                   FontFamily="Arial"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:StarSelector">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:StarSelector">
                    <StackPanel x:Name="LayoutRoot"
                                Orientation="Horizontal">
                        <StackPanel.Background>
                            <LinearGradientBrush EndPoint="0.5,1"
                                                 StartPoint="0.5,0">
                                <GradientStop Color="#FFEEEEEE"
                                              Offset="0" />
                                <GradientStop Color="#FFBDBDBD"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </StackPanel.Background>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="StateNormal" />
                                <vsm:VisualState x:Name="StateDisabled" />
                                <vsm:VisualState x:Name="StateReadOnly" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="MouseStates">
                                <vsm:VisualState x:Name="StateMouseUp" />
                                <vsm:VisualState x:Name="StateMouseDown" />
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <StackPanel x:Name="StarContainer"
                                    Background="Transparent"
                                    Orientation="Horizontal" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:Star">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Star">
                    <Grid Margin="3">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="StateNormal" />
                                <vsm:VisualState x:Name="StateHalfSelected">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.05"
                                                         To="1"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Storyboard.TargetName="HalfItem" />
                                        <DoubleAnimation Duration="0:0:0.05"
                                                         To="0"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Storyboard.TargetName="FullItem" />
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="StateFullSelected">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.05"
                                                         To="0"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Storyboard.TargetName="HalfItem" />
                                        <DoubleAnimation Duration="0:0:0.05"
                                                         To="1"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Storyboard.TargetName="FullItem" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="DisabledStates">
                                <vsm:VisualState x:Name="StateNotDisabled" />
                                <vsm:VisualState x:Name="StateDisabled">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="FullItemPath"
                                                        Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                        To="#FFC1C1C1"
                                                        Duration="0:0:0" />
                                        <ColorAnimation Storyboard.TargetName="FullItemPath"
                                                        Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                        To="#FF4F4F4F"
                                                        Duration="0:0:0" />
                                        <ColorAnimation Storyboard.TargetName="FullItemPath"
                                                        Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                        To="#FFB9B9B9"
                                                        Duration="0:0:0" />
                                        <ColorAnimation Storyboard.TargetName="FullItemPath"
                                                        Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                        To="#FF434343"
                                                        Duration="0:0:0" />
                                        <ColorAnimation Storyboard.TargetName="HalfItemPath"
                                                        Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                        To="#FFC1C1C1"
                                                        Duration="0:0:0" />
                                        <ColorAnimation Storyboard.TargetName="HalfItemPath"
                                                        Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                        To="#FF4F4F4F"
                                                        Duration="0:0:0" />
                                        <ColorAnimation Storyboard.TargetName="HalfItemPath"
                                                        Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                        To="#FF454545"
                                                        Duration="0:0:0" />
                                        <ColorAnimation Storyboard.TargetName="HalfItemPath"
                                                        Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                        To="#FFA3A3A3"
                                                        Duration="0:0:0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Grid x:Name="EmptyItem"
                              Background="Transparent">
                            <Path Stretch="UniformToFill"
                                  StrokeThickness="1.5"
                                  StrokeLineJoin="Round"
                                  Data="F1 M 288,136L 219,136L 192,63.9999L 164.143,136L 96,136L 150.857,184L 123.429,256L 192,208L 260.571,256L 233.143,184L 288,136 Z ">
                                <Path.Stroke>
                                    <RadialGradientBrush RadiusX="0.494924"
                                                         RadiusY="0.494924"
                                                         Center="0.5,0.5"
                                                         GradientOrigin="0.5,0.5">
                                        <RadialGradientBrush.GradientStops>
                                            <GradientStop Color="#FF666666"
                                                          Offset="0" />
                                            <GradientStop Color="#FFD4D4D4"
                                                          Offset="1" />
                                        </RadialGradientBrush.GradientStops>
                                    </RadialGradientBrush>
                                </Path.Stroke>
                                <Path.Fill>
                                    <RadialGradientBrush RadiusX="0.507813"
                                                         RadiusY="0.507813"
                                                         Center="0.5,0.5"
                                                         GradientOrigin="0.5,0.5">
                                        <RadialGradientBrush.GradientStops>
                                            <GradientStop Color="#FFF0F0EE"
                                                          Offset="0" />
                                            <GradientStop Color="#FFA9A9A9"
                                                          Offset="1" />
                                        </RadialGradientBrush.GradientStops>
                                    </RadialGradientBrush>
                                </Path.Fill>
                            </Path>
                        </Grid>
                        <Grid x:Name="HalfItem"
                              Background="Transparent"
                              Opacity="0"
                              HorizontalAlignment="Left">
                            <Path x:Name="HalfItemPath"
                                  Stretch="Uniform"
                                  StrokeThickness="1.5"
                                  StrokeLineJoin="Round"
                                  Data="F1 M192,63.999901 L164.14301,136 L96,136 L150.85699,184 L123.429,256 L192,208 z">
                                <Path.Stroke>
                                    <RadialGradientBrush RadiusX="0.5"
                                                         RadiusY="0.5"
                                                         Center="1,0.5"
                                                         GradientOrigin="1,0.5">
                                        <RadialGradientBrush.GradientStops>
                                            <GradientStop Color="#FFFF9D00"
                                                          Offset="0" />
                                            <GradientStop Color="#FFFFC100"
                                                          Offset="1" />
                                        </RadialGradientBrush.GradientStops>
                                    </RadialGradientBrush>
                                </Path.Stroke>
                                <Path.Fill>
                                    <RadialGradientBrush Center="1,0.5"
                                                         GradientOrigin="1,0.5">
                                        <GradientStop Color="#FFFFFF00"
                                                      Offset="0" />
                                        <GradientStop Color="#FFFF9200"
                                                      Offset="1" />
                                    </RadialGradientBrush>
                                </Path.Fill>
                            </Path>
                        </Grid>
                        <Grid x:Name="FullItem"
                              Background="Transparent"
                              Opacity="0">
                            <Path x:Name="FullItemPath"
                                  Stretch="UniformToFill"
                                  StrokeThickness="1.5"
                                  StrokeLineJoin="Round"
                                  Data="F1 M 288,136L 219,136L 192,63.9999L 164.143,136L 96,136L 150.857,184L 123.429,256L 192,208L 260.571,256L 233.143,184L 288,136 Z ">
                                <Path.Stroke>
                                    <RadialGradientBrush RadiusX="0.494924"
                                                         RadiusY="0.494924"
                                                         Center="0.5,0.5"
                                                         GradientOrigin="0.5,0.5">
                                        <RadialGradientBrush.GradientStops>
                                            <GradientStop Color="#FFFF9D00"
                                                          Offset="0" />
                                            <GradientStop Color="#FFFFC100"
                                                          Offset="1" />
                                        </RadialGradientBrush.GradientStops>
                                    </RadialGradientBrush>
                                </Path.Stroke>
                                <Path.Fill>
                                    <RadialGradientBrush RadiusX="0.507813"
                                                         RadiusY="0.507813"
                                                         Center="0.5,0.5"
                                                         GradientOrigin="0.5,0.5">
                                        <RadialGradientBrush.GradientStops>
                                            <GradientStop Color="#FFFFF500"
                                                          Offset="0" />
                                            <GradientStop Color="#FFFF3900"
                                                          Offset="0.987" />
                                        </RadialGradientBrush.GradientStops>
                                    </RadialGradientBrush>
                                </Path.Fill>
                            </Path>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:CoolMenu">
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="HorizontalAlignment"
                Value="Center" />
        <Setter Property="VerticalAlignment"
                Value="Bottom" />
        <Setter Property="Height"
                Value="100" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:CoolMenu">
                    <Grid Background="{TemplateBinding Background}"
                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                          VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <ItemsPresenter />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:CoolMenuItem">
        <Setter Property="VerticalAlignment"
                Value="Bottom" />
        <Setter Property="Background"
                Value="Transparent" />

        <Setter Property="RenderTransform">
            <Setter.Value>
                <TransformGroup>
                    <TranslateTransform />
                </TransformGroup>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:CoolMenuItem">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid Background="{TemplateBinding Background}">
                            <ContentPresenter Content="{TemplateBinding Content}"
                                              ContentTemplate="{TemplateBinding ContentTemplate}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
